<? include admin_tpl("header")?>
<script language="javascript" src="./include/js/validate.js"></script>
<? if ($op == 'edit'){?>
<td id="mainarea">
<div id="nav">
当前位置: <a href="?action=default">管理首页</a> <span>&gt;</span> <a href="?action=recommendlist">修改推荐位置设置</a>
</div>
<div class="block">
<form id="modform" name="modform" method="post" action="?action=recommendlist&op=editsave" onSubmit="return Validator.Validate(this,1)">
<input name="lid" type="hidden" value="<?=$recommendlist['lid']?>" />
<table width="100%" border="0" align="center">
  <tr>
    <td><div align="center">位置</div></td>
    <td><div align="center">推荐位置</div></td>
    <td><div align="center">限制字数</div></td>
	<td><div align="center">图片宽度</div></td>
	<td><div align="center">高度</div></td>
	<td><div align="center">静态地址</div></td>
  </tr>
  <tr>
    <td><div align="center"><?=$recommendlist['lid']?></div></td>
    <td><div align="center"><input name="lname" type="text" value="<?=$recommendlist['lname']?>" /></div></td>
	<td><div align="center"><input name="fontnum" type="text" value="<?=$recommendlist['fontnum']?>" size="3" maxlength="2" /></div></td>
    <td><div align="center"><input name="width" type="text" value="<?=$recommendlist['width']?>" size="4" maxlength="3" /></div></td>
    <td><div align="center"><input name="height" type="text" value="<?=$recommendlist['height']?>" size="4" maxlength="3" /></div></td>
	<td><div align="center"><input name="filedir" type="text" value="<?=$recommendlist['filedir']?>" size="20" /></div></td>
  </tr>
  <tr>
    <td colspan="9"><div align="center"><button value="true" type="submit" class="submit" name="recommendlistedit" title="提交修改">提交修改</button></div></td>
  </tr>
</table>
</form>
<? } else {?>
<script language="javascript">
function check(){
	var checked_num = 0;
	var obj = document.getElementsByName("lid[]");
	var len = obj.length;
	
	for(i=0;i<len;i++){
		if(obj[i].checked == true){
			checked_num++;
			}
		}
	if(checked_num == 0){
		alert("请选择再删除！");
		return false;}
	else{
		if(window.confirm("确定删除？")){
			document.recomform.action = "admincp.php?action=recommendlist&op=del"; 
			document.recomform.submit();
		}else{
			return false;
			}
		}
}
</script>
<td id="mainarea">
<div id="nav">
当前位置: <a href="?action=default">管理首页</a> <span>&gt;</span> <a href="?action=recommendlist">推荐位置管理</a>
</div>
<div class="block">
<form id="recomform" name="recomform" method="post" action="?action=recommendlist&op=add" onSubmit="return Validator.Validate(this,1)">
<table width="100%" border="0" align="center">
  <tr>
    <td><div align="center">删除</div></td>
    <td><div align="center">位置</div></td>
    <td><div align="center">推荐位置</div></td>
    <td><div align="center">限制字数</div></td>
	<td><div align="center">图片宽度</div></td>
	<td><div align="center">高度</div></td>
	<td><div align="center">静态地址</div></td>
    <td><div align="center">操作</div></td>
  </tr>
  <? foreach($recomlist as $recom){?>
  <tr>
    <td><div align="center"><input type="checkbox" name="lid[]" value="<?=$recom['lid']?>" /></div></td>
    <td><div align="center"><?=$recom['lid']?></div></td>
    <td><div align="center"><?=$recom['lname']?></div></td>
	<td><div align="center"><?=$recom['fontnum']?></div></td>
    <td><div align="center"><?=$recom['width']?></div></td>
    <td><div align="center"><?=$recom['height']?></div></td>
	<td><div align="center"><? if ($recom['filedir']){?><?=$recom['filedir']?><? } else {?>&nbsp;<? }?></div></td>
    <td><div align="center"><a href="?action=recommendlist&op=edit&lid=<?=$recom['lid']?>">修改</a> | <a href="?action=recommend&op=list&lname=<?=$recom['lname']?>&lid=<?=$recom['lid']?>">查看</a> | <a href="?action=recommend&op=add&lid=<?=$recom['lid']?>&lname=<?=$recom['lname']?>&f=<?=$recom['fontnum']?>&w=<?=$recom['width']?>&h=<?=$recom['height']?>" style="color:red;">添加</a><? if ($recom['filedir']){?> | <a href="?action=recomhtml&lid=<?=$recom['lid']?>&filedir=<?=$recom['filedir']?>">生成</a><? }?></div></td>
  </tr>
  <? }?>

  <tr style="background-color:#FFFFCC">
    <td><div align="center"><strong>新增：</strong></div></td>
	<td>&nbsp;</td>
	<td><div align="center"><input type="text" name="lname" dataType="Require" msg="请填写推荐位置"/></div></td>
    <td><div align="center"><input name="fontnum" type="text" size="3" maxlength="2" dataType="Require" msg="请填写限制字数" /></div></td>
    <td><div align="center"><input name="width" type="text" size="4" maxlength="3" /></div></td>
	<td><div align="center"><input name="height" type="text" size="4" maxlength="3" /></div></td>
	<td><div align="center"><input name="filedir" type="text" size="15" /></div></td>
	<td>&nbsp;</td>
  </tr>

  <tr>
    <td><div align="center"><button value="true" type="submit" class="submit" name="recomlistdel" title="选中即删" onclick="check();" disabled>删除</button></div></td>
    <td>&nbsp;</td>
    <td><div align="center"><button value="true" type="submit" class="submit" name="recomlistadd" title="新增">新增</button></div></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
  </tr>

</table>
</form>
<? }?>
</div>
<? include admin_tpl("footer")?>